#version 130

uniform mat4 ModelMatrix;
uniform mat4 ViewMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;

varying vec2 TexCoord;

//varying vec3 AmbientalLightIntensity;
varying vec3 position;
varying vec3 normal;

void main() {

	// the following three lines provide the same result

	//	gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
	//	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
	//	gl_Position = ftransform();

	TexCoord = gl_MultiTexCoord0.xy;

	normal = NormalMatrix * gl_Normal; //get the normal direction, after translation, rotation, scaling
	position = vec3(gl_ModelViewMatrix * gl_Vertex);//get the position of the vertex after translation, rotation, scaling

	gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * gl_Vertex;//output position with projection

}